<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>AngularJS scope service</title>
    <script src="../bower_components/angular/angular.min.js"></script>
</head>
<body ng-app="myapp">
    <div ng-controller="MyController">
        Your name: <input type="text" ng-model="username" />
        <button ng-click="sayHello()">greet</button>
        <hr>
        {{ greeting }}
    </div>

    <script type="text/javascript">
        angular.module('myapp', [])
            .controller('MyController', ['$scope', function($scope) {
                $scope.username = "Jon";

                $scope.sayHello = function() {
                    $scope.greeting = 'Hello ' + $scope.username + '!';
                }
            }]);
    </script>
</body>
</html>